package dba.example.guice.finders

import dba.example.entities.Company
import com.google.inject.persist.finder.Finder
import java.util.List
import java.util.ArrayList
import javax.inject.Named

trait CompanyFinder {

  @Finder(query = "SELECT c FROM Company c ORDER BY c.nameSort, c.id", returnAs = classOf[ArrayList[Company]])
  def findAll(): List[Company]
  
  @Finder(query = "SELECT c FROM Company c WHERE c.nameSort = :nameLowerCase", returnAs = classOf[ArrayList[Company]])
  def getByNameSort(@Named("nameLowerCase") nameLowerCase: String): List[Company]
  
}